package me.sdevil507.biz.fruit.service.impl;

import lombok.extern.slf4j.Slf4j;
import me.sdevil507.biz.fruit.po.FruitOrgRelPo;
import me.sdevil507.biz.fruit.repository.FruitOrgRelRepository;
import me.sdevil507.biz.fruit.service.FruitOrgRelService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


/**
 * @program: tips_back_end
 * @description: 实现类
 * @author: kzl
 * @create: 2020-06-23 17:38
 **/
@Service
@Slf4j
public class FruitOrgRelServiceImpl implements FruitOrgRelService {

    @Resource
    private FruitOrgRelRepository fruitOrgRelRepository;

    @Override
    public void save(FruitOrgRelPo fruitOrgRelPo) {
        fruitOrgRelRepository.save(fruitOrgRelPo);
    }

    @Override
    public FruitOrgRelPo findById(long id) {
        return fruitOrgRelRepository.findById(id).orElse(null);
    }

    @Override
    public FruitOrgRelPo findByCondition(long fruitId, long orgId, String status){
        return fruitOrgRelRepository.findFruitOrgRelPoByFruitIdAndOrgIdAndStatus(fruitId, orgId, status);
    }
}
